<!--
 * @Author: 李明明
 * @Date: 2020-10-19 10:12:48
 * @LastEditTime: 2021-03-12 17:11:01
 * @LastEditors: 李明明
 * @Description: 热点排行
 * @FilePath: /官网改版/web/html/fragment/home-inc/hotspot.htm
 * @代码版权方：'政府采购信息网'
-->


<body>
  <div id="hotspot" class="course" data-num="10">
    <div class="title">
      <p class="title_txt">热点排行</p>
      <ul class="hot_tab">
        <li class="active">日</li>
        <li>周</li>
        <li>月</li>
      </ul>
    </div>
    <ul class="hotspot_list"></ul>
  </div>
</body>
<script src="/web/public/public.js"></script>
<script>
  function getloadChannelHotSearchData(type) {
    var data = {
      plateId: 101,
      pageNum: 1,
      pageSize: $('#hotspot').data('num'),
      queryType: type
    };
    $.ajax({
      url: ports.loadChannelHotSearchData,
      data: data,
      success: function (res) {
        var html = '';
        var list = res.data.list;
        list.forEach(function (item, i) {
          if (item.articleOutLinkStatus == 1) {
            html += '<li>' +
              '<h3><a href="' + item.articleOutLink + '">' +
              '<icon class="' + 'icon-rank ' + (i < 3 ? 'hexagon' : '') + ' rank-' + (i + 1) + '">' + (i + 1) + '</icon>' +
              '<span>' + item.articleTitle + '</span>' +
              '</a></h3>' +
              '</li>'
          } else {
            html += '<li>' +
              '<h3><a href="' + item.articleUrl + '">' +
              '<icon class="' + 'icon-rank ' + (i < 3 ? 'hexagon' : '') + ' rank-' + (i + 1) + '">' + (i + 1) + '</icon>' +
              '<span>' + item.articleTitle + '</span>' +
              '</a></h3>' +
              '</li>'
          }
        });
        $('.hotspot_list').html(html);
      }
    })
  }
  getloadChannelHotSearchData(1);
  var $aTabLi = $('#hotspot ul.hot_tab>li');
  $aTabLi.click(function () {
    $aTabLi.removeClass('active')
    $(this).addClass('active');
    console.log($(this).index())
    getloadChannelHotSearchData($(this).index() + 1);
  });
</script>